package cn.liuhuan1.redis.controller;

import cn.liuhuan1.redisImp.RedisImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: liuhuan
 * @Date: 2021/4/21 - 04 - 21 - 21:13
 * @Description:
 * @version: 1.0
 */
@Controller
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private RedisImp redisImp;

    @RequestMapping(value = "/setValueDate",method = RequestMethod.POST)
    @ResponseBody
    public void setValueDate(String key,String value,Long time){
        redisImp.setValueDate(key,value,time);
    }

    @RequestMapping(value = "/getValue",method = RequestMethod.POST)
    @ResponseBody
    public String getValue(String key){
        String value = redisImp.getValue(key);
        return value;
    }
}
